package com.tlsy.commerce.model_enum;

/**
 * @author Tlsy
 * @version commerce 0.0.1
 * @date 2017/4/22  17:50
 */
public enum RoleTypeEnum {

    SELLER("seller"),
    BUYER("buyer"),
    ADMINISTRATOR("administrator");

    private String type;

    RoleTypeEnum(String  type){
        this.type = type;
    }

    public String  value() {
        return this.type;
    }

    public static RoleTypeEnum fromValue(String type){
        for (RoleTypeEnum roleType : RoleTypeEnum.values()) {
            if(roleType.type.equals(type)){
                return  roleType;
            }
        }

        throw new IllegalArgumentException(String.format("%s不是正确的权限类型代码", type));
    }
}
